<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li{
      height: 50px;
      background-color: #fc8;
      margin-top:5px;
    }
  </style>
</head>
<body>
  <div id="app">
   <!--  <input type="text" v-model="msg">
    {{ msg }} -->
    <input type="text" v-model="obj.b">
    <button @click="addArr">增加</button>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        msg: '你好',
        obj: {
          a:"a",
          b: 'b'
        },
        arr:[1,2,3]
      },
      methods: {
        addArr(){
          this.arr.push(44)
        }
      },
      watch: {
        arr(){
          console.log('数组变化了')
        },
        msg(newVal,oldVal){
          console.log('msg 变化了',newVal,oldVal)
        },
       /*  obj(newVal){
          console.log('值变化了')
        } */
       /*  "obj.a"(newVal){
          console.log('a属性变化了')
        } */
        obj:{
          handler(newVal){
            console.log('obj变化了', newVal)
          },
          deep: true
        }
      }
    })

  
  </script>
</body>
</html>